package com.shiku.imserver.repository.runnable;

import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.shiku.commons.thread.pool.AbstractMapRunnable;
import org.bson.Document;

public abstract class BaseRepositoryMapRunnable<T> extends AbstractMapRunnable<T> {
    protected static final int DB_REMAINDER = 10000;
    protected static final int MIN_USERID = 100000;

    /* access modifiers changed from: protected */
    public MongoCollection<Document> getCollection(MongoDatabase database, String userId) throws Exception {
        return database.getCollection(getCollectionName(Long.valueOf(userId).longValue()));
    }

    /* access modifiers changed from: protected */
    public String getCollectionName(long userId) throws Exception {
        long remainder = 0;
        if (userId > 100000) {
            remainder = userId / 10000;
        }
        return String.valueOf(remainder);
    }

    /* access modifiers changed from: protected */
    public String getCollectionName(String userIdStr) throws Exception {
        long remainder = 0;
        long userId = Long.valueOf(userIdStr).longValue();
        if (userId > 100000) {
            remainder = userId / 10000;
        }
        return String.valueOf(remainder);
    }
}
